<?php

namespace app\process;

use app\services\RedisQueue;
use plugin\admin\app\model\RequestLog;
use support\Redis;
use Workerman\Crontab\Crontab;

class Task1
{
    public function onWorkerStart()
    {
        new Crontab('*/5 * * * * *', function(){
        $data = Redis::lPop('{redis-queue}-failed');
        if (!empty($data)){
            $data = json_decode($data, true);
            switch ($data['queue']){
                case 'order-notify':
                    RedisQueue::orderNotify($data['data']);
                    break;
//                case 'update-balance':
//                    RedisQueue::updateBalance($data['data']);
//                    break;
            }
        }
    });
    }
}